

import service from "./index";


//封装请求
const postByUrl = (url, d) => {
    let method =  'post';
    let data = d || {};
    console.log('进来了',url,d);
    if (url == null) {
        return new Promise((resolve, reject) => {
            reject('请求地址不能为空')
        })
    }
    return service({
        url,
        method,
        data
    })
};

//封装请求
const getByUrl = (url, data) => {
    let method =  'get';
    let params = data || {};
    if (url == null) {
        return new Promise((resolve, reject) => {
            reject('请求地址不能为空')
        })
    }

    return service({
        url,
        method,
        params
    })
};

export {
    postByUrl,
    getByUrl
}